Code
if(base::interactive()) {
params <- rmarkdown::yaml_front_matter(here::here("analysis/03_beta_diversity.qmd"))$params
}
factor_of_interest <- params$factor_of_interestWhere we analyse the effect of a factor on shared diversity
Date: November 25, 2024
See the documentation of the MiscMetabar package for example of btea diversity analysis.
if(base::interactive()) {
params <- rmarkdown::yaml_front_matter(here::here("analysis/03_beta_diversity.qmd"))$params
}
factor_of_interest <- params$factor_of_interestlibrary(knitr)
library(targets)
library(MiscMetabar)
here::i_am("analysis/03_beta_diversity.qmd")
source(here::here("R/styles.R"))d_pq <- clean_pq(tar_read("d_vs", store=here::here("_targets/")))Cleaning suppress 3 taxa and 13 samples.
formattable_pq(
subset_samples(d_pq, Type %in% c("Mix", "Mono")),
factor_of_interest,
min_nb_seq_taxa = 1000,
lev_col_taxa = "Family",
taxonomic_levels=c("Order", "Family", "Genus"),
log10trans = TRUE,
)Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
library("vegan")Le chargement a nécessité le package : permute
Le chargement a nécessité le package : lattice
This is vegan 2.6-8
plot_ordination(d_pq, vegan::decorana(vegdist(as(otu_table(d_pq), "matrix"),
method = "robust.aitchison"
)), color = factor_of_interest) +
geom_point(size = 3) +
stat_ellipse(inherit.aes = F, aes(x = DCA1, y = DCA2, linetype = .data[[factor_of_interest]], col = .data[[factor_of_interest]])) + theme_idest() + scale_color_manual(values=idest_pal$dark_color_idest[[1]][c(5,4,2)])Warning in plot_ordination(d_pq, vegan::decorana(vegdist(as(otu_table(d_pq), :
`Ordination species/OTU/taxa coordinate indices did not match `physeq` index
names. Setting corresponding coordinates to NULL.
Warning in plot_ordination(d_pq, vegan::decorana(vegdist(as(otu_table(d_pq), :
Color variable was not found in the available data you provided.No color
mapped.
Error in `stat_ellipse()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 3rd layer.
Caused by error in `.data[["Type"]]`:
! Column `Type` not found in `.data`.
adonis_pq(subset_samples(d_pq, Type %in% c("Mix", "Mono")), factor_of_interest, na_remove = TRUE, correction_for_sample_size = TRUE, by = "terms")Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
d_pq |>
subset_samples(Type %in% c("Mix", "Mono")) |>
biplot_pq(merge_sample_by = factor_of_interest, rarefy_after_merging = T)Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
res_var <- var_par_rarperm_pq(
subset_samples(d_pq, Type %in% c("Mix", "Mono")),
list_component = list(
"Tmt" = c("Tmt"),
"Bloc" = c("Bloc"),
"Type" = c("Type")
),
nperm = 9,
dbrda_computation = TRUE
)Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Type' introuvable
plot_var_part_pq(res_var)Error: objet 'res_var' introuvable
Session information are detailed below. More information about the machine, the system, as well as python and R packages, are available in the file data_final/information_run.txt .
sessionInfo()R version 4.4.2 (2024-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Debian GNU/Linux 12 (bookworm)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.11.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.11.0
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
time zone: Europe/Paris
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] vegan_2.6-8 lattice_0.22-6 permute_0.9-7 MiscMetabar_0.10.1
[5] purrr_1.0.2 dplyr_1.1.4 dada2_1.34.0 Rcpp_1.0.13-1
[9] ggplot2_3.5.1 phyloseq_1.50.0 targets_1.9.0 knitr_1.49
loaded via a namespace (and not attached):
[1] bitops_1.0-9 deldir_2.0-4
[3] rlang_1.1.4 magrittr_2.0.3
[5] ade4_1.7-22 matrixStats_1.4.1
[7] compiler_4.4.2 mgcv_1.9-1
[9] png_0.1-8 callr_3.7.6
[11] vctrs_0.6.5 reshape2_1.4.4
[13] stringr_1.5.1 pwalign_1.2.0
[15] pkgconfig_2.0.3 crayon_1.5.3
[17] fastmap_1.2.0 backports_1.5.0
[19] XVector_0.46.0 utf8_1.2.4
[21] Rsamtools_2.22.0 rmarkdown_2.29
[23] UCSC.utils_1.2.0 ps_1.8.1
[25] xfun_0.49 zlibbioc_1.52.0
[27] GenomeInfoDb_1.42.0 jsonlite_1.8.9
[29] biomformat_1.34.0 rhdf5filters_1.18.0
[31] DelayedArray_0.32.0 Rhdf5lib_1.28.0
[33] BiocParallel_1.40.0 jpeg_0.1-10
[35] parallel_4.4.2 cluster_2.1.6
[37] R6_2.5.1 RColorBrewer_1.1-3
[39] stringi_1.8.4 GenomicRanges_1.58.0
[41] SummarizedExperiment_1.36.0 iterators_1.0.14
[43] IRanges_2.40.0 Matrix_1.7-1
[45] splines_4.4.2 igraph_2.1.1
[47] tidyselect_1.2.1 abind_1.4-8
[49] yaml_2.3.10 codetools_0.2-20
[51] hwriter_1.3.2.1 processx_3.8.4
[53] tibble_3.2.1 plyr_1.8.9
[55] Biobase_2.66.0 withr_3.0.2
[57] ShortRead_1.64.0 evaluate_1.0.1
[59] survival_3.7-0 RcppParallel_5.1.9
[61] Biostrings_2.74.0 pillar_1.9.0
[63] BiocManager_1.30.25 MatrixGenerics_1.18.0
[65] renv_1.0.11 foreach_1.5.2
[67] stats4_4.4.2 generics_0.1.3
[69] rprojroot_2.0.4 S4Vectors_0.44.0
[71] munsell_0.5.1 scales_1.3.0
[73] base64url_1.4 glue_1.8.0
[75] tools_4.4.2 interp_1.1-6
[77] data.table_1.16.2 GenomicAlignments_1.42.0
[79] rhdf5_2.50.0 grid_4.4.2
[81] ape_5.8 latticeExtra_0.6-30
[83] colorspace_2.1-1 nlme_3.1-166
[85] GenomeInfoDbData_1.2.13 cli_3.6.3
[87] fansi_1.0.6 S4Arrays_1.6.0
[89] gtable_0.3.6 digest_0.6.37
[91] BiocGenerics_0.52.0 SparseArray_1.6.0
[93] htmlwidgets_1.6.4 htmltools_0.5.8.1
[95] multtest_2.62.0 lifecycle_1.0.4
[97] here_1.0.1 httr_1.4.7
[99] secretbase_1.0.3 MASS_7.3-61